'''
Created on 24-11-2010

@author: mwi
'''

import logging


def init_ipython(ns):
    from IPython.Shell import IPShellEmbed
    ipshell = IPShellEmbed(user_ns=ns)
    ipshell() 

def wrap_logging(cb, *args):
    def dumb_log(*args, **kw):
        pass
    lg = logging.getLogger('')
    old_log = lg.setLevel
    lg.setLevel = dumb_log
    cb(*args)   
    lg.setLevel = old_log

def start(ns):
    wrap_logging(init_ipython, ns)

